package cn.cckggroup.springboot.study.controller;

import cn.cckggroup.springboot.study.dto.UserAddDTO;
import cn.cckggroup.springboot.study.dto.UserDTO;
import org.springframework.web.bind.annotation.*;

/**
 * @author zz
 * @date 2023/2/26
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @GetMapping("/get")
    public UserDTO get(@RequestParam("id") Integer id) {
        System.out.println(String.format(" I Come In %d", id));
        return UserDTO.builder().id(id)
                .name("没有昵称：" + id)
                .gender(id % 2 + 1).build();
    }

    @PostMapping("/add")
    public Integer add(UserAddDTO addDTO) {
        return (int) (System.currentTimeMillis() / 1000);
    }
}
